package com.dd.duu.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.dc.entity.users.DRole;
import com.dd.dc.entity.users.DRolePermissionRelation;
import com.dd.dc.entity.users.DUserRoleRelation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 描述: 角色Feign
 *
 * @author: yanglin
 * @Date: 2021-03-12-11:21
 * @Version: 1.0
 */
@FeignClient(value = "dd-user-service")
public interface RoleClient {

    @PostMapping("/user/d-role/findRoleByUserId")
    List<DRole> findRoleByUserId(@RequestParam Integer userId);

    @PostMapping("/user/d-role/saveBatchUR")
    boolean saveBatchUR(@RequestBody List<DUserRoleRelation> roleRelation);

    @DeleteMapping("/user/d-role/deleteUR")
    boolean deleteUR(@RequestParam Integer userId);

    @PostMapping("/user/d-role/queryRoleList")
    Page<DRole> queryRoleList(@RequestParam int page, @RequestParam int limit, @RequestParam String roleName);

    @PostMapping("/user/d-role/insert")
    Integer insert(@RequestBody DRole role);

    @PostMapping("/user/d-role/updateById")
    boolean updateById(@RequestBody DRole role);

    @PostMapping("/user/d-role/saveBatchRP")
    boolean saveBatchRP(@RequestBody List<DRolePermissionRelation> rolePermissionRelations);

    @DeleteMapping("/user/d-role/delete")
    boolean delete(@RequestParam Integer roleId);

    @DeleteMapping("/user/d-role/deleteRP")
    boolean deleteRP(@RequestParam Integer roleId);

    @PostMapping("/user/d-role/queryRelationByRoleId")
    boolean queryRelationByRoleId(@RequestParam Integer roleId);


}
